<?php
require_once('../simpletest/autorun.php');
require_once '../class/user.php';

class TestOfUser extends UnitTestCase {

    function testLoginUser(){
        $user = new User;
        $user->setName("eduard");
        $user->setLogin("eduard@yopmail.com");
        $user->setPasswd("passe");
        $this->assertTrue($user->login());
      //  $this->assertFalse($user->login("redward", "mauvais mot de passe"));
    }
/*
    function testNewUser(){

        $user = new User();
        $user->setName("Renaud");
        $user->setLogin("renaud@email.be");
        $user->setPasswd("titi");
        $user->register();

        $con = Connection::getInstance();
  //      $this->assertEqual(count($con->getUsers()), 5);
    }
*/
    function testRegister() {
        $user = new User();
       $user->setName("Renaud");
        $user->setLogin("renaud@email.be");
        $user->setPasswd("titi");
        $user->setAdr("rue machin 1000 Bruxelles");
        $user->setDn("11/12/2012");

        try {
            $user->register();
        }catch(Exception $ex){}

        $user = new User;
        $user->setName("Renaud");
        $user->setLogin("renaud@email.be");
        $user->setPasswd("titi");
        $this->assertTrue($user->login());
        //$this->asserTrue($user->getAdress()=="renaud@email.be");

    }
}
?>
